<?

###################################################################
# Block Country para Modulo Monitor v 2.0                         #
# Muestra las estadisticas de visitantes segun paises             #
#                                                                 #
###################################################################

global $cookie, $prefix, $admin, $dbi;
get_lang(Monitor);
function buscarDom($tdomain){
include ("modules/Monitor/country.php");
	return $country;
}


$result = sql_query("SELECT MAX(hits) FROM $prefix"._monitor_pais."", $dbi);
list($conta) = sql_fetch_row($result, $dbi);
$content .= "<table width=\"100%\" border=\"0\" cellspacing=\"1\">";
$listar = 6;
$contarl = 0;
$result = sql_query("SELECT hits, pais FROM $prefix"._monitor_pais." ORDER BY hits DESC", $dbi);
while((list($phits, $ppais) = sql_fetch_row($result, $dbi)) && ($contarl<$listar)){
      if (!(($ppais == "???") or ($ppais == "com") or ($ppais == "biz") or($ppais == "net") or($ppais == "org") or ($ppais == "info"))){
      $imagen = "modules/Monitor/images/flags2/"."$ppais".".gif";
      	if (!(file_exists($imagen))) $imagen = "modules/Monitor/images/flags2/blank.gif";
      	$lpais=buscarDom($ppais);
      	$content .= "<tr><td width=\"18\"><img src=\"$imagen\" ALT=\"$lpais\"></td>";
      	$largo = (sprintf ("%01.2f",($phits*90)/$conta) . " ");
      	$largo = $largo + 5;
      	$content .= "<td><img src=\"modules/Monitor/images/hbar00b.gif\" height=\"7\" width=\"$largo%\" alt=\"$phits\"></td></tr>";
      	$contarl++;
     }
}
$content .= "</table>";



$now = date("d-m-Y-H-i");
$dot = explode ("-",$now);
$nowdate = $dot[0];
$nowmonth = $dot[1];
$nowyear = $dot[2];
$hora = $dot[3];

$result = sql_query("select hits from ".$prefix."_monitor_date WHERE (date=$nowdate AND month=$nowmonth AND year=$nowyear)", $dbi);
list($hitshoy) = sql_fetch_row($result, $dbi);

$digitos = strlen($hitshoy);
$content .= "<hr noshade size=\"1\"><center>";
for ($i=0; $i<$digitos; $i++){
	$imagen = $hitshoy[$i];
	$content .= "<img src=\"modules/Monitor/images/num/$imagen".".gif\" align=\"absmiddle\">";
}




$content .= "</center>";


?>